import { lazy } from 'react'
import { Navigate } from 'react-router-dom'
import lazyLoad from '../utils/lazyLoad'
import MainLayout from '../layout'
import Login from '../pages/Login'
const routes = [
  {
    path: '/',
    element: <Navigate to='/home' />
  },
  {
    path: '/',
    name: 'layout',
    element: <MainLayout />,
    children: [
      {
        path: '/home',
        name: '首页',
        icon: 'DesktopOutlined',
        element: lazyLoad(lazy(() => import('@/pages/Home')))
      },
      {
        path: '/about',
        name: '关于',
        icon: 'PieChartOutlined',
        element: lazyLoad(lazy(() => import('@/pages/About')))
      },
      {
        path: '/option',
        name: '配置',
        icon: 'UserOutlined',
        element: lazyLoad(lazy(() => import('@/pages/Option'))),
        children: [
          {
            path: '/option/tom',
            name: '汤姆',
            icon: 'UserOutlined',
            element: lazyLoad(lazy(() => import('@/pages/Option/Tom')))
          }
        ]
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    element: <Login />
  },
  {
    path: '*',
    element: <Navigate to='/home' />
  }
]

export default routes
